
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理中心</title>
    <link href="{:asset('css/admin/reset.css')}" rel="stylesheet" type="text/css">
    <link href="{:asset('css/admin/zh-cn-system.css')}" rel="stylesheet" type="text/css">
    <link href="{:asset('css/admin/table_form.css')}" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/jscal2.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/border-radius.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/win2k/win2k.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/admin/upload.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('js/admin/skins/default.css')}">
    <style type="text/css">
        .attachment-list li {
            width: 120px;
            padding: 5px 0;
        }
    </style>
    <script type="text/javascript" src="{:asset('js/jquery.min.js')}"></script>
    <script type="text/javascript" src="{:asset('js/jquery.cookie.js')}"></script>
    <script type="text/javascript" src="{:asset('js/admin/admin_common.js')}"></script>
    <script type="text/javascript" src="{:asset('js/JSCal/jscal2.js')}"></script>
    <script type="text/javascript" src="{:asset('js/JSCal/lang/cn.js')}"></script>
</head>
<body>
    <div>
        <form name="myform" action="" method="get">
            <table width="100%" cellspacing="0" class="search-form">
                <tr>
                    <td>
                        <div class="lh26 explain-col"> 时间：<input type="text" name="start_time" id="start_time" value="<?php echo $_GET['start_time']; ?>" class="date input-text" readonly="">
                            <script type="text/javascript">
                                Calendar.setup({
                                    weekNumbers: false,
                                    inputField : "start_time",
                                    trigger    : "start_time",
                                    dateFormat: "%Y-%m-%d",
                                    showTime: false,
                                    minuteStep: 1,
                                    onSelect   : function() {this.hide();}
                                });
                            </script>&nbsp;-&nbsp;<input type="text" name="end_time" id="end_time" value="<?php echo $_GET['end_time']; ?>" class="date input-text" readonly=""><script type="text/javascript">
                                Calendar.setup({
                                    weekNumbers: false,
                                    inputField : "end_time",
                                    trigger    : "end_time",
                                    dateFormat: "%Y-%m-%d",
                                    showTime: false,
                                    minuteStep: 1,
                                    onSelect   : function() {this.hide();}
                                });
                            </script>
                            <label>名称</label>
                            <input type="text" value="<?php echo $_GET['filename']; ?>" class="input-text" name="filename">
                            <input type='hidden' name='CKEditor' value='<?php echo $_GET['CKEditor']; ?>'>
                            <input type='hidden' name='CKEditorFuncNum' value='<?php echo $_GET['CKEditorFuncNum']; ?>'>
                            <input type='hidden' name='langCode' value='<?php echo $_GET['langCode']; ?>'>
                            <input type="submit" value="搜索" class="button" name="search">
                        </div>
                    </td>
                </tr>
            </table>
        </form>
        <ul class="attachment-list" id="fsUploadProgress">
            <?php foreach ($attachs as $key => $attach) { ?>
            <li>
                <div class="img-wrap">
                    <a href="javascript:;" onclick="javascript:album_cancel(this,'<?php echo $attach['id']; ?>')">
                        <div class="icon"></div>
                        <?php if( in_array($attach['ext'], array( 'jpg','gif','png','jpeg' ) )  ) { ?>
                        <img src="<?php echo $attach['url']; ?>" width="100" height="88" path="<?php echo $attach['url']; ?>" title="<?php echo $attach['name']; ?>">
                        <?php } else { ?>
                        <img src="IMG_PATH/admin/flv.png" width="80" path="<?php echo $attach['url']; ?>" title="<?php echo $attach['name']; ?>">
                        <?php } ?>
                    </a>
                </div>
            </li>
            <?php } ?>
        </ul>
        <div id="pages"><?php echo $pages; ?></div>
        <table class="aui_dialog" align="right">
            <tr>
                <td colspan="2" class="aui_footer">
                    <div class="aui_buttons">
                        <button class="aui_state_highlight" data-type="commit" type="button">确定</button><button type="button" data-type="cancel">取消</button>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        function album_cancel(obj,id){
            var src = $(obj).children("img").attr("path");
            var filename = $(obj).children("img").attr("title");
            if($(obj).hasClass('on')){
                $(obj).removeClass("on");
            } else {
                var num = $("#fsUploadProgress a.on").length;
                var file_upload_limit = 1;
                if(num >= file_upload_limit) {alert('不能选择超过'+file_upload_limit+'个附件'); return false;}
                $(obj).addClass("on");
            }
        }

        $(document).ready(function(){
            $(".aui_buttons button").click(function(e){
                $type = $(this).data("type");
                if ($type == 'commit') {
                    var src = $("#fsUploadProgress a.on");
                    if (src.length > 0) {
                        window.opener.CKEDITOR.tools.callFunction(<?php echo $_GET['CKEditorFuncNum']; ?>, $(src).children("img").attr("path"));
                    };
                    // window.opener.CKEDITOR.tools.callFunction(<?php echo $_GET['CKEditorFuncNum']; ?>, '');
                }
                window.close();
            })
        })
    </script>
</body>
</html>